/**
 * @author wonderful-wudaohong wuketidai@foxmail.com
 * @version 1.0.5
 * @create 20120428
 * @descript 自定义表单验证，一部分同事反对我写这个东东，说自己写的不成熟，但是自己用着好就是了
 * @change 20121116 wonderful 添加了密码输入比较验证
 * @change 20131017 wonderful 修改了存在验证调用方式，和普验证一样调用，增加了单个验证元素的触发提示
 * @change 20141222 wonderful 添加了验证成功消息只要加入successMsg属性就能实现，属性类型为字符串即输入成功后提示的消息
 * @isnull 不能为空
 * @ischecked checkbox 是否选中
 * @maxlen 最大字符输入个数
 * @minlen 最小字符输入个数
 * @email 电子邮件
 * @phone 手机电话
 * @post 邮编
 * @num  20180820 wonderful 可限长度数值,取值范围true|false，必须配合numdotbefore和numdotafter使用。
 * @isnumneg 是否支持负数 false|true
 * @numdotbefore 取值范围正整数或者如：0,9来表示小数点前的位数,这里的9只是示例，可以是任意正整数。
 * @numdotafter 取值范围正整数或者如：0,9来表示小数点后的位数,这里的9只是示例，可以是任意正整数。
 * @numdotafterdefault 小数点后位数补齐，如："000"，则会把没有小数点的数值,如6补齐为6.000,有小数后位数的如6.1补齐为6.100。
 * @onlynumber 只能正整数或小数
 * @onlycn 只能中文
 * @equals 比较相等验证
 * @postfix 后缀验证
 * @exists 存在验证
 * @price 价格验证
 * @integer 正整数验证
 * @nvenum 枚举验证
 * @change 20160823 wonderful 添加了元素验证启用禁用控制 通过添加isDisable（取值true/false）属性来开启
 * @change 20160831 wonderful 枚举验证
 * @custom 20180322 wonderful 自定义验证,用于复杂的交互逻辑，如动态添加设备类型-品牌-型号。
 * valCustomUrl 自定义验证的后台请求参数
 *  customCommonId 公共验证标识，如果是多行验证，且把需要的内容做了一次提交验证，则通过后通过此标识判断其它同质验证是否需要请求验证。
 *  valObj 自己定义验证对象，inputname优先级较高，原生js element元素。
 * beginEvent(inputObj){//自定义验证请求前触发事件，inputObj为当前指向的验证输入对象。
 * return {
 * isNotReq:true|false //如果返回包含该参数并且值为true，则不会发起请求并会触发focusObjs。
 * focusObjs:[{focusObjID:"",msg:""}]//isNotReq为true时生效
 * } 返回请求到服务端的参数
 * return false 如个返回false则终止验证
 * }
 * endEvent(data,inputObj){//自定义验证服务端返回成功后触发的事件，data为服务端返回的json对象，必须包含status属性，值为0|1，1为验证成功0为失败
 * 
 * 当data.status为0时
 * return 返回验证失败要指定消息聚焦的输入对象ID，data.data的格式为[{focusObjID:"",msg:""}]，注意这里是数组，多个以逗号分隔。
 * 当data.status为1时
 * return 返回的格式同上，但是这里是指定已显示验证未通过提示消息的输入框，进行消息清除操作。
 * 
 * }
 * @isnotzero 20180820 wonderful 非0验证，如果该值为0或0xx.0xx则验证不通过。
 *
 * 20190801 0859 增加验证消息框的位置调整功能
 * 调整验证消息的位置，验证消息默认位置紧贴被验证值域的正后方
 * pos:{
 *     left:xx,默认位置向左移动的量，单位px。
 *     right:xx默认位置向右移动的量，单位px。
 * }
 */

var keys;
var msgs;
var wdfparams;

/**
 * 
 * @param valParam
 *            验证参数集合
 * @description 返回所有参数集合的键集
 */
function getAllKey(valParam) {
	keys = new Array();
	msgs = new Array();
    wdfparams = valParam;
	for (var i = 0; i < valParam.length; i++) {
		var ki = 0;
		var subkeys = new Array();
		for (var key in valParam[i]) {
			subkeys[ki] = key;
			ki++;
		}
		keys[i] = subkeys;
	}
}
/**
 * 验证参数
 * 
 * @param valParam
 * @description 对指定对象的值进行验证!
 */
function valValue(valParam) {
	var ref = true;
	for (var i = 0; i < keys.length; i++) {
		var element = document.getElementById(valParam[i].inputname);
		var noerror = true;
		$("#"+element.id).addClass("verificationInputTips");
		if(valParam[i].isDisable){
			continue;
		}
		
		for (var si = 0; si < keys[i].length; si++) {
			if(keys[i].hidden){
				ref = true;
				alert(keys[i].hidden);
			}
			// 非空
		     else if (keys[i][si] == "isnull" &&valParam[i].isnull&& noerror) {
				if ((element.value&&$.trim(element.value) == "") || !element.value) {

					ref = false;
					var rightmove;
					var message;
					if (valParam[i].isnullmsg) {
						if(!valParam[i].msgType){
						message = $("#"+valParam[i].inputname).parents("tr").find(".label").html();
						message = message.replace("：","")+"不能为空"
						}else{
							message=valParam[i].isnullmsg;
						}
					} else {
						message = "不能为空!";
					}
					if (valParam[i].rightmove) {
						rightmove = valParam[i].rightmove;
					} else {
						rightmove = 0;
					}
					if(valParam[i].showMsg){
						valParam[i].showMsg(message,element);
					}else{
					createMsg("isnull", element, message, rightmove,false,valParam[i],valParam[i].msgType);
					removeValMsg(valParam[i],"isnull");
					}
					noerror = false;
				} else {
					if(valParam[i].showMsg){
						valParam[i].removeMsg(element);
					}else{
					var remsg = document.getElementById("msg"
							+ valParam[i].inputname + "isnull");
					if (remsg) {
						$('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                        $('#'+element.id).css("borderColor","");
					}
					if(valParam[i].successMsg){
						createMsg("isnull", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
					}
					}

				}
				// checkbox是否选中
			} else if (keys[i][si] == "ischecked" && noerror) {
				var elements = $("input[name='" + valParam[i].inputname + "']")
						.attr("checked", true);

			} else if (keys[i][si] == "maxvalue" && noerror) {
		     	//输入最大值判断
				if (element.value > valParam[i].maxvalue) {
					var rightmove;
					var message;
					ref = false;
					if (valParam[i].maxvaluemsg) {
						message = valParam[i].maxvaluemsg;
					} else {
						message = "最多输入: " + valParam[i].maxvalue;
					}
					if (valParam[i].rightmove) {
						rightmove = valParam[i].rightmove;
					} else {
						rightmove = 0;
					}
					if(valParam[i].showMsg) {
						valParam[i].showMsg(message,element);
					}else{
						createMsg("maxvalue", element, message, rightmove,false,valParam[i],valParam[i].msgType);
						removeValMsg(valParam[i],"maxvalue");
					}
					noerror = false;
				}

			} else if (keys[i][si] == "minlen" && noerror) {

				if (element.value.length < valParam[i].minlen
						&& element.value != "") {
					ref = false;
					var rightmove;
					var message;
					if (valParam[i].minlenmsg) {
						message = valParam[i].minlenmsg;
					} else {
						message = "至少输入:" + valParam[i].minlen + "位!";
					}
					if (valParam[i].rightmove) {
						rightmove = valParam[i].rightmove;
					} else {

						rightmove = 0;
					}
					if(valParam[i].showMsg){
						valParam[i].showMsg(message,element);
					}else{
					createMsg("minlen", element, message, rightmove,false,valParam[i],valParam[i].msgType);
					removeValMsg(valParam[i],"minlen");
					}
					noerror = false;
				} else {
					if(valParam[i].showMsg){
						valParam[i].removeMsg(element);
					}else{
					var remsg = document.getElementById("msg"
							+ valParam[i].inputname + "minlen");
					if (remsg) {

						$('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                        $('#'+element.id).css("borderColor","");

					}
					if(valParam[i].successMsg){
						createMsg("isnull", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
					}
					}
				}
				// 最大字符输入个数
			} else if (keys[i][si] == "maxlen" && noerror) {
				if (element.value.length > valParam[i].maxlen) {
					var rightmove;
					var message;
					ref = false;
					if (valParam[i].maxlenmsg) {
						message = valParam[i].maxlenmsg;
					} else {
						message = "至多输入:" + valParam[i].maxlen + "位!";
					}
					if (valParam[i].rightmove) {
						rightmove = valParam[i].rightmove;
					} else {
						rightmove = 0;
					}
					if(valParam[i].showMsg){
						valParam[i].showMsg(message,element);
					}else{
					createMsg("maxlen", element, message, rightmove,false,valParam[i],valParam[i].msgType);
					removeValMsg(valParam[i],"maxlen");
					}
					noerror = false;
				} else {
					if(valParam[i].showMsg){
						valParam[i].removeMsg(element);
					}else{
					var remsg = document.getElementById("msg"
							+ valParam[i].inputname + "maxlen");
					if (remsg) {
						$('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                        $('#'+element.id).css("borderColor","");
					}
					if(valParam[i].successMsg){
						createMsg("isnull", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
					}
					}
				}
			}
			// 电子邮件
			else if (keys[i][si] == "email" && valParam[i].email == true
					&& noerror) {

				if (element.value.length != 0) {
					regex = /^(([0-9a-zA-Z]+)|([0-9a-zA-Z]+[_.0-9a-zA-Z-]*[0-9a-zA-Z]+))@([a-zA-Z0-9-]+[.])+([a-zA-Z]{2}|net|NET|com|COM|gov|GOV|mil|MIL|org|ORG|edu|EDU|int|INT)$/;

					var result = regex.exec(element.value);

					if (result == null || result == "" || result == undefined) {
						ref = false;
						var rightmove;
						var message;
						if (valParam[i].emailmsg) {
							message = valParam[i].emailmsg;

						} else {
							message = "电子邮件地址不正确！";

						}
						if (valParam[i].rightmove) {
							rightmove = valParam[i].rightmove;
						} else {

							rightmove = 0;
						}
						if(valParam[i].showMsg){
							valParam[i].showMsg(message,element);
						}else{
						createMsg("email", element, message, rightmove,false,valParam[i]);
						removeValMsg(valParam[i],"email");
						}
						noerror = false;

					} else {
						if(valParam[i].showMsg){
							valParam[i].removeMsg(element);
						}else{
						var remsg = document.getElementById("msg"
								+ valParam[i].inputname + "email");
						if (remsg) {

							$('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                            $('#'+element.id).css("borderColor","");

						}
						if(valParam[i].successMsg){
							createMsg("isnull", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
						}
						}
					}
				}

			}
			// 手机电话
			else if (keys[i][si] == "phone" && valParam[i].phone == true
					&& noerror) {
				if (element.value.length != 0) {
					regex = /((1(3|4|5|7|8|9)\d{9})|(0(\d{3}|\d{2}|\d{1})\-+(\d{7}|\d{8})))/;

					var result = regex.exec(element.value);
					if (result == null || result == "" || result == undefined) {
						ref = false;
						var rightmove;
						var message;
						if (valParam[i].phonemsg) {
							message = valParam[i].phonemsg;

						} else {
							message = "电话号码不正确！";

						}
						if (valParam[i].rightmove) {
							rightmove = valParam[i].rightmove;
						} else {

							rightmove = 0;
						}
						if(valParam[i].showMsg){
							valParam[i].showMsg(message,element);
						}else{
						createMsg("phone", element, message, rightmove,false,valParam[i],valParam[i].msgType);
						removeValMsg(valParam[i],"phone");
						}
						noerror = false;

					} else {
						if(valParam[i].showMsg){
							valParam[i].removeMsg(element);
						}else{
						var remsg = document.getElementById("msg"
								+ valParam[i].inputname + "phone");
						if (remsg) {

							$('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                            $('#'+element.id).css("borderColor","");

						}

						if(valParam[i].successMsg){
							createMsg("isnull", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
						}
					}
					}
				}

			}
			// 邮编
			else if (keys[i][si] == "post" && valParam[i].post == true
					&& noerror) {

				if (element.value.length != 0) {
					regex = /^[1-9][0-9]{5}$/;

					var result = regex.exec(element.value);

					if (result == null || result == "" || result == undefined) {
						ref = false;
						var rightmove;
						var message;
						if (valParam[i].postmsg) {
							message = valParam[i].postmsg;

						} else {
							message = "邮编错误！";

						}
						if (valParam[i].rightmove) {
							rightmove = valParam[i].rightmove;
						} else {

							rightmove = 0;
						}
						if(valParam[i].showMsg){
							valParam[i].showMsg(message,element);
						}else{
						createMsg("post", element, message, rightmove,false,valParam[i],valParam[i].msgType);
						removeValMsg(valParam[i],"post");
						}
						noerror = false;

					} else {
						if(valParam[i].showMsg){
							valParam[i].removeMsg(element);
						}else{
						var remsg = document.getElementById("msg"
								+ valParam[i].inputname + "post");
						if (remsg) {

							$('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                            $('#'+element.id).css("borderColor","");


						}

						if(valParam[i].successMsg){
							createMsg("isnull", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
						}
						}
					}

				}

			}
			// 只能正整数或小数
			else if (keys[i][si] == "onlynumber"
					&& valParam[i].onlynumber == true && noerror) {

				if (element.value.length != 0) {
					// regex = /^[0-9]*[0-9][0-9]*$/;
                    //
					// var resultnumber = regex.exec(element.value);

					regex = /^\d+(\.{0,1}\d+){0,1}$/;

					var resultreal = regex.exec(element.value);

					if (!resultreal) {
						ref = false;
						var rightmove;
						var message;
						if (valParam[i].onlynumbermsg) {
							message = valParam[i].onlynumbermsg;

						} else {
							message = "只能输入数字或小数！";

						}
						if (valParam[i].rightmove) {
							rightmove = valParam[i].rightmove;
						} else {

							rightmove = 0;
						}
						if(valParam[i].showMsg){
							valParam[i].showMsg(message,element);
						}else{
						createMsg("onlynumber", element, message, rightmove,false,valParam[i],valParam[i].msgType);
						removeValMsg(valParam[i],"onlynumber");
						}
						noerror = false;
					

					} else {
						if(valParam[i].showMsg){
							valParam[i].removeMsg(element);
						}else{
						var remsg = document.getElementById("msg"
								+ valParam[i].inputname + "onlynumber");
						if (remsg) {

							$('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                            $('#'+element.id).css("borderColor","");

						}

						if(valParam[i].successMsg){
							createMsg("isnull", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
						}
						}
					}
				}

			}
			// 只能是中文
			else if (keys[i][si] == "onlycn" && noerror) {

				if (element.value.length != 0) {
					regex = /[\u4e00-\u9fa5]/;

					var result = regex.exec(element.value);
					// alert(result);
					if (result == null || result == "" || result == undefined) {
						ref = false;
						var rightmove;
						var message;
						if (valParam[i].onlycnmsg) {
							message = valParam[i].onlycnmsg;

						} else {
							message = "只能输入汉字！";

						}
						if (valParam[i].rightmove) {
							rightmove = valParam[i].rightmove;
						} else {

							rightmove = 0;
						}
						if(valParam[i].showMsg){
							valParam[i].showMsg(message,element);
						}else{
						createMsg("onlycn", element, message, rightmove,false,valParam[i],valParam[i].msgType);
						removeValMsg(valParam[i],"onlycn");
						}
						noerror = false;

					} else {
						if(valParam[i].showMsg){
							valParam[i].removeMsg(element);
						}else{
						var remsg = document.getElementById("msg"
								+ valParam[i].inputname + "onlycn");
						if (remsg) {

							$('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                            $('#'+element.id).css("borderColor","");

						}

						if(valParam[i].successMsg){
							createMsg("isnull", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
						}
						}
					}
				}

			}
			// 暂未实现
			else if (keys[i][si] == "onlyen" && noerror) {
				if (element.value.length != 0) {
					regex = /[\u4e00-\u9fa5]/;

					var result = regex.exec(element.value);

					if (result == null || result == "" || result == "undifined") {
						ref = false;
						var rightmove;
						var message;
						if (valParam[i].onlycnmsg) {
							message = valParam[i].onlycnmsg;

						} else {
							message = "只能输入汉字！";

						}
						if (valParam[i].rightmove) {
							rightmove = valParam[i].rightmove;
						} else {

							rightmove = 0;
						}
						createMsg("onlycn", element, message, rightmove,false,valParam[i],valParam[i].msgType);
						noerror = false;

					} else {

						var remsg = document.getElementById("msg"
								+ valParam[i].inputname + "onlycn");
						if (remsg) {

							$('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                            $('#'+element.id).css("borderColor","");

						}

						if(valParam[i].successMsg){
							createMsg("isnull", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
						}

					}
				}

			}
			// 比较验证
			else if (keys[i][si] == "equals" && noerror) {
				var repeatInput = document
						.getElementById(valParam[i].repeatInput);
				var rightmove = 0;
				var message = "两次输入不一致！";
				if (repeatInput.value != element.value) {
					ref = false;
					if (valParam[i].equalsmsg)
						message = valParam[i].equalsmsg;
					if (valParam[i].rightmove)
						rightmove = valParam[i].rightmove;
					createMsg("equals", repeatInput, message, rightmove,false,valParam[i],valParam[i].msgType);
					removeValMsg(valParam[i],"equals");
					noerror = false;
				} else {

					var remsg = document.getElementById("msg"
							+ valParam[i].repeatInput + "equals");
					if (remsg) {

						$('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                        $('#'+element.id).css("borderColor","");

					}

					if(valParam[i].successMsg){
						createMsg("isnull", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
					}
				}

			}
			// 图片后缀验证
			else if (keys[i][si] == "postfix" && noerror) {
				if (element.value == "")
					return;
				regex = /[\W\w]+\.{1}(jpg|JPG|jpeg|JPEG|png|PNG|gif|GIF){1}/;
				var result = regex.exec(element.value);
				var message = "只能是jpg/png/gif！";
				var rightmove = 0;
				if (!result) {
					ref = false;
					if (valParam[i].postfixmsg)
						message = valParam[i].postfixmsg;
					if (valParam[i].rightmove)
						rightmove = valParam[i].rightmove;
					if(valParam[i].showMsg){
						valParam[i].showMsg(message,element);
					}else{
					createMsg("postfix", element, message, rightmove,false,valParam[i],valParam[i].msgType);
					removeValMsg(valParam[i],"postfix");
					}
					noerror = false;
				} else {
					if(valParam[i].showMsg){
						valParam[i].removeMsg(element);
					}else{
					var remsg = document.getElementById("msg"
							+ valParam[i].inputname + "postfix");
					if (remsg) {

						$('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                        $('#'+element.id).css("borderColor","");

					}

					if(valParam[i].successMsg){
						createMsg("isnull", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
					}
					}

				}

			}
			// 存在验证
			else if (keys[i][si] == "exists" && valParam[i].exists == true
					&& noerror) {
				var element = document.getElementById(valParam[i].inputname);
				$.ajax({
					url : valParam[i].url,
					type : "post",
					dataType : "json",
					data : valParam[i].postdata(),
					async : false,
					cache : false,
					success : function(data, textStatus) {
						var exists=data.status==SUCCESS?data.data:null;

						if (exists.isExists==true) {

								ref = false;
								var rightmove;
								var message;
								if (valParam[i].existsmsg) {
									message = valParam[i].existsmsg;
								} else {
									message = "该值已存在！";
								}
								if (valParam[i].rightmove) {
									rightmove = valParam[i].rightmove;
								} else {

									rightmove = 0;
								}
								if(valParam[i].showMsg){
									valParam[i].showMsg(message,element);
								}else{
								createMsg("exists", element, message, rightmove,false,valParam[i],valParam[i].msgType);
								removeValMsg(valParam[i],"exists");
								}
								noerror = false;

							} else if(exists.isExists==false){
								if(valParam[i].showMsg){
									valParam[i].removeMsg(element);
								}else{
								var remsg = document.getElementById("msg"
										+ valParam[i].inputname + "exists");
								if (remsg) {

									$('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                                    $('#'+element.id).css("borderColor","");

								}

								if(valParam[i].successMsg){
									createMsg("isnull", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
								}
								}

							}
						 else {
							alert("系统异常，存在验证失败！");
						}
						if(valParam[i].existscallback){
							valParam[i].existscallback(data);
						}

					},
					error : function(XMLHttpRequest, textStatus, errorThrown) {
						alert("系统异常，存在验证失败！");
					}

				});
			}
			// 价格验证
			else if (keys[i][si] == "price" && valParam[i].price == true
					&& noerror) {
				var element = document.getElementById(valParam[i].inputname);
				if (element.value.length != 0) {
					regex = /^\[0-9]*$/;

					var resultnumber = regex.test(element.value);

                    var reNum =/^(-?\d+)(\.\d+)?$/;
                    var isdigit = reNum.test(element.value);

                    var resultreal
                    if(isdigit){
                    	//如果是浮点数才验证是不是有1位或2位小数点
                        regex = /^(?!0+(?:\.0+)?$)(?:[1-9]\d*|0)(?:\.\d{1,2})?$/;
                        resultreal= regex.exec(parseFloat(element.value));
					}else{
                    	//不是浮点数验证不通过
                        resultreal = false;
					}

					if (!resultnumber && !resultreal) {
						ref = false;
						var rightmove;
						var message;
						if (valParam[i].pricemsg) {
							message = valParam[i].pricemsg;

						} else {
							message = "价格只能是整数或保留两位小数！";

						}
						if (valParam[i].rightmove) {
							rightmove = valParam[i].rightmove;
						} else {

							rightmove = 0;
						}
						if(valParam[i].showMsg){
							valParam[i].showMsg(message,element);
						}else{
						createMsg("price", element, message, rightmove,false,valParam[i],valParam[i].msgType);
						removeValMsg(valParam[i],"price");
						}
						noerror = false;

					} else {
						if(valParam[i].showMsg){
							valParam[i].removeMsg(element);
						
						}else{
							var remsg = document.getElementById("msg"
									+ valParam[i].inputname + "price");
							if (remsg) {

								$('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                                $('#'+element.id).css("borderColor","");

							}

							if(valParam[i].successMsg){
								createMsg("isnull", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
							}
						}
                        if(element.value.indexOf(".")==-1){
                            element.value +=".00";
                        }
					}
				}

			}

			// 整形验证
			else if (keys[i][si] == "integer" && valParam[i].integer == true
					&& noerror) {
				var element = document.getElementById(valParam[i].inputname);
				if (element.value.length != 0) {
					regex = /^(0|\+?[1-9][0-9]*)$/;
					var valueStr = element.value+"";
					var resultnumber = regex.exec(parseFloat(element.value));

					if (!resultnumber || valueStr.indexOf(".")!=-1) {
						ref = false;
						var rightmove;
						var message;
						if (valParam[i].integermsg) {
							message = valParam[i].integermsg;

						} else {
							message = "只能是正整数！";

						}
						if (valParam[i].rightmove) {
							rightmove = valParam[i].rightmove;
						} else {
							rightmove = 0;
						}
						if(valParam[i].showMsg){
							valParam[i].showMsg(message,element);
						}else{
						createMsg("integer", element, message, rightmove,false,valParam[i],valParam[i].msgType);
						removeValMsg(valParam[i],"integer");
						}
						noerror = false;

					} else {
						if(valParam[i].showMsg){
							valParam[i].removeMsg(element);
						}else{
						var remsg = document.getElementById("msg"+ valParam[i].inputname + "integer");
						if (remsg) {

							$('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                            $('#'+element.id).css("borderColor","");

						}
						
							if(valParam[i].successMsg){
								createMsg("isnull", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
							}
						
						}

					}
				}

			}
			// 可以是带符号的任意整数或小数
			else if (keys[i][si] == "num" && valParam[i].num == true
					&& noerror) {
				var element = document.getElementById(valParam[i].inputname);
				if (element.value.length != 0) {
					//补0操作
					if(valParam[i]. numdotafterdefault){
					var val=element.value;
					var valStr=new String(val);
					if(valStr.indexOf(".")==-1){
                        valStr=valStr+"."+valParam[i].numdotafterdefault;
					}else if(valStr.split(".")[1]==""){
                        valStr=valStr+valParam[i].numdotafterdefault;
					}else {
                        var diffLen=valParam[i].numdotafterdefault.length-valStr.split(".")[1].length;
                        if(diffLen>0){
                        	for(var i=0;i<diffLen;i++){
                                valStr+="0";
							}
						}
					}
					element.value=valStr;
					}

                    var resultnumber=false;
                    var resultreal =false;

                    var sign="";
                    //允许为负
                    if(valParam[i].isnumneg){
                        sign="\\-?";
					}
                        //小数点前后位数长度控制
                        if (valParam[i].numdotbefore && !valParam[i].numdotafter) {
                            regex = new RegExp("^" + sign + "(0{1}|([1-9]+[0-9]*){" + valParam[i].numdotbefore + "}).([0-9]|[1-9])+$");
                            resultnumber = regex.exec(element.value);
                        } else if (!valParam[i].numdotbefore && valParam[i].numdotafter) {
                            regex = new RegExp("^" + sign + "(0{1}|[1-9]+[0-9]*).([0-9]|[1-9]){" + valParam[i].numdotafter + "}$");
                            resultnumber = regex.exec(element.value);
                        } else if (valParam[i].numdotbefore && valParam[i].numdotafter) {
                            regex = new RegExp("^" + sign + "(0{1}|([1-9]+[0-9]*){" + valParam[i].numdotbefore + "}).([0-9]|[1-9]){" + valParam[i].numdotafter + "}$");
                            resultnumber = regex.exec(element.value);
                        } else {
                            regex = /^\-?[0-9]*([1-9]|[0-9])*$/;
                            resultnumber = regex.exec(element.value);
                            regex = /^\-?(0{1}|[1-9]+[0-9]*).[0-9]+[1-9]*$/;
                            resultreal = regex.exec(element.value);
                        }

					if (!resultnumber&&!resultreal) {
						ref = false;
						var rightmove;
						var message;
						if (valParam[i].nummsg) {
							message = valParam[i].nummsg;

						} else {
							message = "只能是数字！";

						}
						if (valParam[i].rightmove) {
							rightmove = valParam[i].rightmove;
						} else {
							rightmove = 0;
						}
						if(valParam[i].showMsg){
							valParam[i].showMsg(message,element);
						}else{
						createMsg("num", element, message, rightmove,false,valParam[i],valParam[i].msgType);
						removeValMsg(valParam[i],"num");
						}
						noerror = false;

					} else {
						if(valParam[i].showMsg){
							valParam[i].removeMsg(element);
						}else{
						var remsg = document.getElementById("msg"+ valParam[i].inputname + "num");
						if (remsg) {

							$('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                            $('#'+element.id).css("borderColor","");

						}
						
							if(valParam[i].successMsg){
								createMsg("isnull", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
							}
						
						}

					}
				}

			}
			//名称和值枚举如：男-1,女-2
			else if (keys[i][si] == "nvenum" && valParam[i].nvenum == true
					&& noerror) {
				var element = document.getElementById(valParam[i].inputname);
				if (element.value.length != 0) {
					regex = /^[\u4e00-\u9fa5a-zA-Z-0-9]+\-{1}[\u4e00-\u9fa5a-zA-Z-0-9]+$/;
					regex2=/^([\u4e00-\u9fa5a-zA-Z-0-9]+\-{1}[\u4e00-\u9fa5a-zA-Z-0-9]+\,{1})+([\u4e00-\u9fa5a-zA-Z-0-9]+\-{1}[\u4e00-\u9fa5a-zA-Z-0-9]{1})$/;
					var resultnvenum = regex.exec(element.value);
                    var resultnvenum2 = regex2.exec(element.value);
					if (!resultnvenum&&!resultnvenum2) {
						ref = false;
						var rightmove;
						var message;
						if (valParam[i].nummsg) {
							message = valParam[i].nummsg;

						} else {
							message = "枚举格式错误！";
						}
						if (valParam[i].rightmove) {
							rightmove = valParam[i].rightmove;
						} else {
							rightmove = 0;
						}
						if(valParam[i].showMsg){
							valParam[i].showMsg(message,element);
						}else{
						createMsg("nvenum", element, message, rightmove,false,valParam[i],valParam[i].msgType);
						removeValMsg(valParam[i],"nvenum");
						}
						noerror = false;

					} else {
						if(valParam[i].showMsg){
							valParam[i].removeMsg(element);
						}else{
						var remsg = document.getElementById("msg"+ valParam[i].inputname + "nvenum");
						if (remsg) {

							$('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                            $('#'+element.id).css("borderColor","");

						}
						
							if(valParam[i].successMsg){
								createMsg("isnull", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
							}
						
						}

					}
				}

			}
			//自定义验证
			else if (keys[i][si] == "custom"
								&& noerror) {
							var element = document.getElementById(valParam[i].inputname);
							//获取自定义验证对象
							if(!element&&valParam[i].valObj){
								element=valParam[i].valObj;
							}
							var curValParam=valParam[i];
				//如果存在全局验证标识定义，则优先判断是否有其它同质化验证通过，如果有，则不再验证。
                if (curValParam.customCommonId && $("body").data(curValParam.customCommonId)) {
                    return ref;
                }

                var result=curValParam.beginEvent(element);

                //如果不发起请求
                if(result&&result.isNotReq){
                    noerror = false;
                    ref = false;
                    var focusObjs=result.focusObjs;
                    if(focusObjs!=null&&focusObjs.length>0){
                        for(var y=0;y<focusObjs.length;y++){
                            var focusObj=focusObjs[y].focusObj;
                            var curValMsg=focusObjs[y].msg;
                            createMsg("custom",focusObj.length>0?focusObj[0]:element,curValMsg?curValMsg:"验证失败！", rightmove,false,curValParam,curValParam.msgType);
                            removeValMsg(curValParam,"custom",focusObj);
                        }
                    }
                }else  if(result){
							$.ajax({
								url : curValParam.customValUrl,
								type : "post",
								dataType : "json",
								data : result,
								async : false,
								cache : false,
								success : function(data, textStatus) {
									
									//如果验证失败，则执行结束方法，并在返回的聚焦对象上显示对应的消息。
									if(data.status==0){
										noerror = false;
										ref = false;
										if(data.data){
                                            if(curValParam.endEvent){
                                            	var focusObjs=curValParam.endEvent(data,element);
                                            	if(focusObjs!=null&&focusObjs.length>0){
                                            		for(var y=0;y<focusObjs.length;y++){
                                            	    var focusObj=focusObjs[y].focusObj;
                                            	    var curValMsg=focusObjs[y].msg;
                                            		createMsg("custom",focusObj.length>0?focusObj[0]:element,curValMsg?curValMsg:"验证失败！", rightmove,false,curValParam,curValParam.msgType);
                                                	removeValMsg(curValParam,"custom",focusObj);
                                            		}
                                            	}
											}
											
										}else{
											alert("自定义验证服务端请求返回异常，没有附带业务数据！");
										}
									//如果验证成功，则执行结束方法，并把返回的聚焦对象管理的消息进行删除。
									}else if(data.status==1){
										// 缓存同质化验证判断标识，避免重复请求验证。
										if(curValParam.customCommonId){
											$("body").data(curValParam.customCommonId,true);
										}
										var focusObjs=curValParam.endEvent(data,element);
										if(data.data){
                                    	if(focusObjs!=null&&focusObjs.length>0){
                                    		for(var i=0;i<focusObjs.length;i++){
                                    	    var focusObj=focusObjs[i].focusObj;
                                        	removeValMsg(curValParam,"custom",focusObj);
                                    		}
                                    	}
									 }
									}else{
										alert("自定义验证服务端请求返回异常,状态值返回不正确！");
                                        noerror = false;
                                        ref = false;
									}
								},
								error : function(XMLHttpRequest, textStatus, errorThrown) {
									alert("自定义验证失败，请求服务器异常！");
                                    noerror = false;
                                    ref = false;
								}
							});
                }
			}
            //非0
            else if (keys[i][si] == "isnotzero" && valParam[i].isnotzero == true &&
                noerror) {
                var params = valParam[i];
                regex = /^0+$/;
                resultzero = regex.exec(element.value);
                regex = /^0+.0+$/;
                resultzeroreal = regex.exec(element.value);
                if (resultzero||resultzeroreal) {
                    ref = false;
                    var rightmove;
                    var message;
                    if (valParam[i].isnotzeromsg) {
                        message = valParam[i].isnotzeromsg;
                    } else {
                        message = "不能为0！";
                    }
                    if (valParam[i].rightmove) {
                        rightmove = valParam[i].rightmove;
                    } else {
                        rightmove = 0;
                    }
                    if(valParam[i].showMsg){
                        valParam[i].showMsg(message,element);
                    }else{
                        createMsg("isnotzero", element, message, rightmove,false,valParam[i],valParam[i].msgType);
                        removeValMsg(valParam[i],"isnotzero");
                    }
                    noerror = false;

                } else {
                    if(valParam[i].showMsg){
                        valParam[i].removeMsg(element);
                    }else{
                        var remsg = document.getElementById("msg"+ valParam[i].inputname + "isnotzero");
                        if (remsg) {

                            $('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                            $('#'+element.id).css("borderColor","");

                        }

                        if(valParam[i].successMsg){
                            createMsg("isnotzero", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
                        }

                    }

                }
            }
            //特殊字符验证
            else if (keys[i][si] == "specialChar" && valParam[i].specialChar == true
                && noerror) {

                if (element.value.length != 0) {

                    var pattern = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\]<>/?~！@#￥……&*（）——|{}【】‘；：”“'。，、？]");
                    if (pattern.test(element.value)) {
                        ref = false;
                        var rightmove;
                        var message;
                        if (valParam[i].specialCharmsg) {
                            message = valParam[i].specialCharmsg;

                        } else {
                            message = "不能有特殊字符！";

                        }
                        if (valParam[i].rightmove) {
                            rightmove = valParam[i].rightmove;
                        } else {

                            rightmove = 0;
                        }
                        if(valParam[i].showMsg){
                            valParam[i].showMsg(message,element);
                        }else{
                            createMsg("specialChar", element, message, rightmove,false,valParam[i],valParam[i].msgType);
                            removeValMsg(valParam[i],"specialChar");
                        }
                        noerror = false;

                    } else {
                        if(valParam[i].showMsg){
                            valParam[i].removeMsg(element);
                        }else{
                            var remsg = document.getElementById("msg"
                                + valParam[i].inputname + "specialChar");
                            if (remsg) {

                                $('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
                                $('#'+element.id).css("borderColor","");

                            }
                            if(valParam[i].successMsg){
                                createMsg("isnull", element,valParam[i].successMsg,valParam[i].rightmove,true,valParam[i],valParam[i].msgType);
                            }
                        }
                    }
                }

            }


        }

	/*	if(noerror){
			if(valParam[i].successMsg){
				createMsg("isnull", element,valParam[i].successMsg,valParam.rightmove,true,valParam[i]);
			}
		
	}*/

}
	return ref;
}
// 执行函数
function executeVal(valParam) {

	getAllKey(valParam);
	var rel = valValue(valParam);
	// window.onresize = removeAllMsg;
	return rel;
}
/**
 * 
 * @param element
 *            要计算坐标的元素对象
 * @returns {Number} 返回x坐标
 */
function getElementViewLeft(element) {
	var elementScrollLeft = 0;
	var actualLeft = element.offsetLeft;
	var current = element.offsetParent;
	while (current !== null) {
		actualLeft += current.offsetLeft;
		current = current.offsetParent;
	}
	if (document.compatMode == "BackCompat") {
		elementScrollLeft = document.body.scrollLeft;
	} else {
		elementScrollLeft = document.documentElement.scrollLeft;
	}
	return actualLeft;
}
/**
 * 
 * @param element
 *            要计算坐标的元素对象
 * @returns {Number} 返回y坐标
 */
function getElementViewTop(element) {
	var elementScrollTop = 0;
	var actualTop = element.offsetTop;
	var current = element.offsetParent;
	while (current !== null) {
		actualTop += current.offsetTop;
		current = current.offsetParent;
	}
	if (document.compatMode == "BackCompat") {
		elementScrollTop = document.body.scrollTop;
	} else {
		elementScrollTop = document.documentElement.scrollTop;
	}
	return actualTop;
}

/**
 * 
 * @description 创建消息提示框
 * @param type
 *            验证类型
 * @param element
 *            被验证元素
 * @param message
 *            提示消息
 * @param rightmove
 *            消息和被验证元素的自定义距离，默认紧靠
 */
function createMsg(type, element, message, rightmove,success,valObj,msgType) {
	var x = 0;
	var y = 0;
	var width = 0;
	var elements = new Array();
	var reapeter;
	var types = ["isnull", "checked", "minlen", "maxlen", "email", "phone",
			"post", "onlynumber", "onlycn", "onlyen", "onlycnen", "exists",
			"equals", "postfix", "price","integer","nvenum","custom","isnotzero","specialChar"];
	for (var i = 0; i < types.length; i++) {
		var remsg = document.getElementById("msg" + element.id + types[i]);
		if (remsg) {
			$('#'+element.id).parent('td').next('td').find('.wdfValidateMsg').remove();
            $('#'+element.id).css("borderColor","");

		}
	}
	elements[0] = document.getElementById("msg" + element.id + "isnull");
	elements[1] = document.getElementById("msg" + element.id + "checked");
	elements[2] = document.getElementById("msg" + element.id + "minlen");
	elements[3] = document.getElementById("msg" + element.id + "maxlen");
	elements[4] = document.getElementById("msg" + element.id + "email");
	elements[5] = document.getElementById("msg" + element.id + "phone");
	elements[6] = document.getElementById("msg" + element.id + "post");
	elements[7] = document.getElementById("msg" + element.id + "onlynumber");
	elements[8] = document.getElementById("msg" + element.id + "onlycn");
	elements[9] = document.getElementById("msg" + element.id + "onlyen");
	elements[10] = document.getElementById("msg" + element.id + "onlycnen");
	elements[11] = document.getElementById("msg" + element.id + "exists");
	elements[12] = document.getElementById("msg" + element.id + "equals");
	elements[13] = document.getElementById("msg" + element.id + "postfix");
	elements[14] = document.getElementById("msg" + element.id + "price");
	elements[15] = document.getElementById("msg" + element.id + "integer");
	elements[16] = document.getElementById("msg" + element.id + "nvenum");
	elements[17] = document.getElementById("msg" + element.id + "custom");
    elements[18] = document.getElementById("msg" + element.id + "isnotzero");
    elements[19] = document.getElementById("msg" + element.id + "specialChar");
	var msg = document.createElement("div");// 获得提示DIV
    if(!success){
	msg.innerHTML = "<div class='wdfValidate_Ico'></div><div class='wdfValidate_Msg'>"
			+ message + "</div>";
    }
    else{
    	msg.innerHTML = "<div class='wdfValidate_Ico'></div><div class='wdfValidate_Msg_Success'>"
			+ message + "</div>";
    }
  
   
    if(valObj.position){
    	var posElement=$("#"+valObj.position.posID);
    	if(valObj.position.direction){
    		if(valObj.position.direction=="bottom"){
    			x = posElement.offset().left;
    			y = posElement.offset().top+posElement.height();
    		}
    		else if(valObj.position.direction=="top"){
    			x = posElement.offset().left;
    			y = posElement.offset().top-posElement.height()-$(msg).height();
    		}
    		if(valObj.position.top){
    			y+=valObj.position.top;
    			
    		}
    		if(valObj.position.left){
    			x+=valObj.position.left;
    		}
    		
    	}
    
    }
    else{
    if(msgType!='EditGridRowMsg'){
	x = $(element).offset().left + element.offsetWidth;
    }else{
    x = $(element).offset().left+19;
    }
	y = $(element).offset().top;
	 if(rightmove&&msgType!='EditGridRowMsg')
	    x += rightmove;
    }
	msg.className = "wdfValidateMsg";
	msg.id = "msg" + element.id + type;
	if(!msgType){

        $('#'+element.id).parent('td').next('td').find(".wdfValidateMsg").remove();
		$('#'+element.id).parent('td').next('td').append(msg);
        $('#'+element.id).css("borderColor","#ed4c4c");
	}else if(msgType=='EditGridRowMsg'){
	$(msg).attr("class","editGridRowMsg");
	document.body.appendChild(msg);
	}
	$(msg).css({
				left : x,
				top : y
			});

}

// 移出所有消息
function removeAllMsg(valParam) {
	
	if(valParam){
		$(valParam).each(function(){
			
				$("div[id*=msg"+this.inputname+"]").remove();
			
		});
		return;
	}
	$("div[id*='msg']").remove();
}
//定时删除消息
function removeValMsg(exObj,valName,focusObj){
if(exObj.autoremove)
	{
	var removeName=exObj.inputname;
	if(focusObj)
		removeName=focusObj.attr("id");
	if(valName=='equals')
		{
		removeName=exObj.repeatInput;
		}
	setTimeout(function(){
		$("#msg"+removeName+valName).animate({"opacity":0},exObj.autoremove);
	},1000);
	setTimeout(function(){
		$("#msg"+removeName+valName).remove();
	},exObj.autoremove+1000);
	
	}
}
// 线程等待
function wait(msecs) {
	var start = new Date().getTime();
	var current = start;
	while (current - start < msecs) {
		current = new Date().getTime();

	}
}

// 存在验证状态对象
function State(value) {
	var state = value;
	return {
		state : state
	};

}

// 带存在判断的表单验证
function executeExistsVal(existsparams, normalparams, callback) {
	var state = new State(true);
	getAllKey(normalparams);
	valExists(existsparams, 0, state, callback, normalparams);

}
/**
 * 
 * @param params 存在验证参数集合
 * @param index 索引
 * @param state 状态对象
 * @param callback 回调函数
 * @param params1 普通验证参数集合
 */
function valExists(params, index, state, callback, params1) {
	if (params != null && params[index] != undefined && params[index] != null) {

		var param = params[index];
		var curparams = params;
		var curparams1 = params1;
		var curindex = index;
		var curstate = state;
		var curcallback = callback;
		var element = document.getElementById(param.inputname);
		$.ajax({
					url : params[index].url,
					type : "post",
					dataType : "json",
					data : params[index].postdata,
					async : true,
					cache : false,
					success : function(data, textStatus) {
						if (data.exists && data.exists != "") {

							if (param.istrue != data.exists) {

								curstate.state = false;
								var rightmove;
								var message;
								if (param.existsmsg) {
									message = param.existsmsg;

								} else {
									message = "该值已存在！";

								}
								if (param.rightmove) {
									rightmove = param.rightmove;
								} else {

									rightmove = 0;
								}
								createMsg("exists", element, message, rightmove);

							} else {

								var remsg = document.getElementById("msg"
										+ param.inputname + "exists");
								if (remsg) {

									$('#'+element.id).parent('td').next('td').remove(remsg);

								}

							}
						} else {
							alert("数据格式错误存在验证失败！");
							curstate.state = false;
						}
						curindex = curindex + 1;
						// 递归
						valExists(curparams, curindex, curstate, curcallback,
								curparams1);
					},
					error : function(XMLHttpRequest, textStatus, errorThrown) {

						alert("存在验证失败，服务器异常！");

					}

				});
	}
	// 如果递归完成
	else {

		if (valValue(params1) && state.state) {
			setTimeout(callback, 100);

		}
	}

}
//生成验证事件
function createValidateEvent(returnParam) {
	// 获取验证参数数组
	var param = returnParam();
	$(param).each(function(i) {
		// 事件对象
		var eventObj;
		// 如果是重复比较验证提示框定位为重复元素
		if (this.repeatInput) {
			eventObj = this.repeatInput;
		} else {
			eventObj = this.inputname;
		}

		// 封装参数获取函数获取针对当前元素的单个参数对象
		returnSubParam = function(i) {
			return returnParam()[i];
		};

		if (this.event && this.event == "change") {
			var removeEvent=$("#" + eventObj).data("valEvent");
			if(removeEvent&&typeof(removeEvent)=="function"){
				$("#" + eventObj).unbind("change",removeEvent);
			}
			var valEvent=getBindEvent(returnSubParam, i);
			$("#" + eventObj).data("valEvent",valEvent);
			$("#" + eventObj).bind("change",valEvent);
			if (this.equals) {
				$("#" + this.inputname).bind("change",valEvent);
			}
		} else if (this.event && this.event == "blur") {
			var removeEvent=$("#" + eventObj).data("valEvent");
			if(removeEvent&&typeof(removeEvent)=="function"){
				$("#" + eventObj).unbind("blur",removeEvent);
			}
			var valEvent=getBindEvent(returnSubParam, i);
			$("#" + eventObj).data("valEvent",valEvent);
			$("#" + eventObj).bind("blur",valEvent);
			if (this.equals) {
				$("#" + this.inputname).bind("blur",valEvent);
			}

		} else if (this.event && this.event == "click") {
			var removeEvent=$("#" + eventObj).data("valEvent");
			if(removeEvent&&typeof(removeEvent)=="function"){
				$("#" + eventObj).unbind("click",removeEvent);
			}
			var valEvent=getBindEvent(returnSubParam, i);
			$("#" + eventObj).data("valEvent",valEvent);
			$("#" + eventObj).bind("click",valEvent);
			if (this.equals) {
				$("#" + this.inputname).bind("click",valEvent);
			}
		}
		else if (this.event && this.event == "mouseover") {
			var removeEvent=$("#" + eventObj).data("valEvent");
			if(removeEvent&&typeof(removeEvent)=="function"){
				$("#" + eventObj).unbind("mouseover",removeEvent);
			}
			var valEvent=getBindEvent(returnSubParam, i);
			$("#" + eventObj).data("valEvent",valEvent);
			$("#" + eventObj).bind("mouseover",valEvent);
			
			if (this.equals) {
				$("#" + this.inputname).bind("mouseover",valEvent);
			}
		}
		
		else if (this.event && this.event == "interval") {
			
			var removeEvent=$("#" + eventObj).data("valEvent");
			if(removeEvent&&typeof(removeEvent)=="function"){
				 window.clearTimeout(removEvent,10);
			}
			var event=getBindEvent(returnSubParam, i);
			var posObj=null;
			var valParm=returnSubParam(i);
			if(valParm.position&&valParm.position.posID)
				{
				posObj=$("#"+valParm.position.posID);
				}
			else{
				posObj=$("#" + eventObj);
			}
			
			
			function getValEvent(event,posObj){
				return function(){
					
					if(posObj.height()>0)
						event();
					
			};
			
			
		  }
		 var valEvent= getValEvent(event,posObj);
			$("#" + eventObj).data("valEvent",valEvent);
			window.setInterval(valEvent,1000);
			}
		
	});
	// 通过函数返回方式,每次都通过执行函数动态获取参数数组以便获取输入框动态值
	/**
	 * event 获取单个参数的函数对象，index 当前元素的参数索引
	 */
	function getBindEvent(event, index) {
		return function() {
		
			// 动态获取当前控件验证参数
			var subParam = event(index);
			// 执行验证
			executeVal([subParam]);

		};

	}
}
